package LanQiao._13JavaB;

import java.util.Arrays;
import java.util.Scanner;

public class _4最少刷题数 {

    //WA 超时  30%
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        int[] arr = new int[n];
        int[] ret = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scan.nextInt();
        }
        int[] sorted = new int[n];
        System.arraycopy(arr, 0, sorted, 0, n);
        Arrays.sort(sorted);
        for (int i = 0; i < n; i++) {
            int temp = arr[i];
            int count = 0;
            while (helper(arr[i], sorted)){
                arr[i]++;
                System.arraycopy(arr, 0, sorted, 0, n);
                Arrays.sort(sorted);
                count++;
            }
            arr[i] = temp;
            ret[i] = count;
        }
        for (int i = 0; i < n; i++) {
            if (i != n -1){
                System.out.print(ret[i] + " ");
            }else {
                System.out.print(ret[i]);
            }
        }
        scan.close();
    }

    public static boolean helper(int num,int[] nums){
        int n = nums.length;
        int l = 0,r = 0;
        int left = 0,right = n - 1;
        while (left <= right){
            int mid = left + (right - left) / 2;
            if (nums[mid] >= num){
                right = mid - 1;
            }else{
                left = mid + 1;
            }
        }
        l = left;
        left = 0;
        right = n - 1;
        while (left <= right){
            int mid = left + (right - left) / 2;
            if (nums[mid] <= num){
                left = mid + 1;
            }else{
                right = mid - 1;
            }
        }
        r = n - right - 1;
        if (r <= l) return false;
        else return true;
    }

    //前缀和 + 二分查找
    //nlog(n)
    class Solution{

        static int N = 100001;
        static int[] count = new int[N];

        public static void main(String[] args) {
            Scanner scan = new Scanner(System.in);
            //在此输入您的代码...
            int n = scan.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = scan.nextInt();
                count[arr[i]]++;
            }
            for (int i = 1; i < N; i++) {
                count[i] += count[i - 1];
            }
            for (int i = 0; i < n; i++) {
                int num = arr[i];
                if ((num == 0 ? 0 : count[num - 1]) >= count[N - 1] - count[num]) {
                    if (i == n - 1){
                        System.out.print(0);
                    }else {
                        System.out.print(0 + " ");
                    }
                    continue;
                }
                int helper = helper(num);
                if (i == n - 1){
                    System.out.print(helper - num);
                }else {
                    System.out.print((helper - num) + " ");
                }
            }
            scan.close();
        }

        public static int helper(int num){
            int left = num + 1,right = N - 1;
            while (left <= right){
                int mid = left + (right - left) / 2;
                if (count[mid - 1] - 1 < count[N - 1] - count[mid] ){
                    left = mid + 1;
                }else {
                    right = mid - 1;
                }
            }
            return left;
        }

    }

}
